import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: () => import("@/views/layout/index.vue"),
      redirect: "/foods",
      children: [
        {
          path: "/accounts",
          name: "accounts",
          component: () => import("@/views/layout/Account/index.vue"),
        },
        {
          path: "/foods",
          name: "foods",
          component: () => import("@/views/layout/Food/index.vue"),
        },
        {
          path: "/money",
          name: "money",
          component: () => import("@/views/layout//Money/index.vue"),
        },
        {
          path: "/records",
          component: () => import("@/views/layout/Records/index.vue"),
        },
        {
          path: "/budget",
          component: () => import("@/views/layout/Budget/index.vue"),
        },
        {
          path: "/billReminder",
          component: () => import("@/views/layout/BillRemainder/index.vue"),
        },
        {
          path: "/report",
          component: () => import("@/views/layout/Report/index.vue"),
        },
        {
          path: "/savings",
          component: () => import("@/views/layout/SavingGoal/index.vue"),
        },
        {
          path: "/inventory",
          component: () => import("@/views/layout/FoodInventory/index.vue"),
        },
        {
          path: "/expireReminder",
          component: () =>
            import("@/views/layout/FoodExpireReminder/index.vue"),
        },
        {
          path: "/recipeSuggestion",
          component: () =>
            import("@/views/layout/FoodRecipeSuggestion/index.vue"),
        },
        {
          path: "/shoppingList",
          component: () => import("@/views/layout/ShoppingList/index.vue"),
        },
      ],
    },
    {
      path: "/login",
      component: () => import("@/views/login/index.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      name: "NotFound",
      component: () => import("@/views/NotFound.vue"),
    },
  ],
});

export default router;
